USE [office]
GO

/****** Object:  Table [dbo].[student]    Script Date: 2012-09-25 00:05:34 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[student](
	[last_name] [varchar](30) NULL,
	[first_name] [varchar](20) NULL,
	[first_name2] [varchar](20) NULL,
	[address_flat_no] [int] NULL,
	[address_home_no] [int] NULL,
	[id] [int] NOT NULL,
	[pesel] [int] NULL,
	[address_street] [date] NULL,
	[birth_date] [date] NULL,
	[birth_city] [varchar](20) NULL,
	[birth_district] [varchar](6) NULL,
	[fk_province] [int] NULL,
	[sex] [varchar](10) NULL,
	[address_postal_code] [varchar](6) NULL,
	[address_city] [varchar](20) NULL,
	[address_district] [varchar](20) NULL,
	[address_manicipality] [varchar](20) NULL,
	[fk_province_address] [int] NULL,
	[address_cor_street] [varchar](30) NULL,
	[address_cor_flat_no] [int] NULL,
	[address_cor_home_no] [int] NULL,
	[address_cor_city] [varchar](16) NULL,
	[address_cor_postal_code] [varchar](6) NULL,
	[email] [varchar](50) NULL,
	[phone_no] [int] NULL,
	[school_branch] [varchar](20) NULL,
	[comments] [varchar](255) NULL,
	[photo] [image] NULL,
	[opiekun1_id] [int] NULL,
	[fk_evidence] [int] NULL,
	[nationality] [varchar](30) NULL,
	[acceptance_date] [datetime] NULL,
	[graduating_date] [datetime] NULL,
	[fk_approach] [int] NULL,
	[fk_holiday] [int] NULL,
	[fk_kindergarden_obligation] [int] NULL,
 CONSTRAINT [pk_student] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[student]  WITH CHECK ADD  CONSTRAINT [fk_approach] FOREIGN KEY([fk_approach])
REFERENCES [dbo].[approach] ([id])
GO

ALTER TABLE [dbo].[student] CHECK CONSTRAINT [fk_approach]
GO

ALTER TABLE [dbo].[student]  WITH CHECK ADD  CONSTRAINT [fk_evidence] FOREIGN KEY([fk_evidence])
REFERENCES [dbo].[evidence] ([id])
GO

ALTER TABLE [dbo].[student] CHECK CONSTRAINT [fk_evidence]
GO

ALTER TABLE [dbo].[student]  WITH CHECK ADD  CONSTRAINT [fk_holiday] FOREIGN KEY([fk_holiday])
REFERENCES [dbo].[holiday] ([id])
GO

ALTER TABLE [dbo].[student] CHECK CONSTRAINT [fk_holiday]
GO

ALTER TABLE [dbo].[student]  WITH CHECK ADD  CONSTRAINT [fk_kindergarden_obligation] FOREIGN KEY([fk_kindergarden_obligation])
REFERENCES [dbo].[kindergarden_obligation] ([id])
GO

ALTER TABLE [dbo].[student] CHECK CONSTRAINT [fk_kindergarden_obligation]
GO

ALTER TABLE [dbo].[student]  WITH CHECK ADD  CONSTRAINT [fk_province] FOREIGN KEY([fk_province])
REFERENCES [dbo].[province] ([id])
GO

ALTER TABLE [dbo].[student] CHECK CONSTRAINT [fk_province]
GO

ALTER TABLE [dbo].[student]  WITH CHECK ADD  CONSTRAINT [fk_province_address] FOREIGN KEY([fk_province_address])
REFERENCES [dbo].[province] ([id])
GO

ALTER TABLE [dbo].[student] CHECK CONSTRAINT [fk_province_address]
GO

